function Monster(map, left, top, isKing) {
	// call the super-constructor
	Character.call(this, map, {
		left: left,
		top: top,
		width: 0,
		height: 0,
		isAutoMoving: true,
		canJump: Math.random() > 0.5,
		spriteData: {
			image: _images.object,
			frameWidth: 57,
			frameHeight: 57,
			interval: 300
		}
	});
    
    this.isKing = isKing || false;
	this.pause = false;
	this.lastPause = 0;
    
    if(this.isKing){   // king pig
        this.typeMonster = "king";
        this.isAutoMoving = false;
        this.canJump = false;
        this.isJumping = false;
        this.life = 3;
        this.width = 37;
		this.height = 44;
        this.addSprite({ // bif pig
			name: "pig_king",
			startFrame: 108,
			framesCount: 4,
			marginTop: 0,
			marginBottom: 0,
			marginLeft: 4,
			marginRight: 4
		});
        
        this.addSprite({ // hitter sprite
			name: "hitted",
			startFrame: 112,
			framesCount: 2,
			marginTop: 0,
			marginBottom: 0,
			marginLeft: 4,
			marginRight: 4
		});
	} else if (this.canJump) {
		// small pig
		this.typeMonster = "small";
		this.width = 33;
		this.height = 32;

		this.addSprite({ // small pig
			name: "pig_jump_left",
			startFrame: 68,
			framesCount: 2,
			marginTop: 9,
			marginBottom: 8,
			marginLeft: 8,
			marginRight: 8
		});
		this.addSprite({
			name: "pig_jump_right",
			startFrame: 66,
			framesCount: 2,
			marginTop: 9,
			marginBottom: 8,
			marginLeft: 8,
			marginRight: 8
		});
	} else {
		// big pig
		this.typeMonster = "big";
		this.width = 37;
		this.height = 34;
		this.addSprite({ // big pig
			name: "pig_left",
			startFrame: 76,
			framesCount: 4,
			marginTop: 8,
			marginBottom: 7,
			marginLeft: 5,
			marginRight: 5
		});
		this.addSprite({ // bif pig
			name: "pig_right",
			startFrame: 72,
			framesCount: 4,
			marginTop: 8,
			marginBottom: 7,
			marginLeft: 5,
			marginRight: 5
		});
        
	} 

	this.addSprite({ // die
		name: "die",
		startFrame: 96,
		framesCount: 9,
		marginTop: 0,
		marginBottom: 0,
		marginLeft: 0,
		marginRight: 0
	});
}

Monster.prototype = new Character();

Monster.prototype.update = function() {
	Character.prototype.update.call(this);

	if (this.canJump && this.speedX != 0)
		this.setSprite(this.speedX > 0 ? "pig_jump_right" : "pig_jump_left");
	else if (this.typeMonster == "big")
        this.setSprite(this.speedX > 0 ? "pig_right" : "pig_left");
    else if(this.isKing)
        this.setSprite("pig_king");
        
	this.collide(this.map.bullets);
}

Monster.prototype.collide = function(bullets) {

	for (var i = 0; i < bullets.length; i++) {
		var m = bullets[i];

		if (!(this.left > m.right ||
			this.right < m.left ||
			this.top > m.bottom ||
			this.bottom < m.top)) {
			if (this.width < 30) {
				this.top = this.bottom - this.height;
				this.width = 30;
				this.height = 30;

			}
            this.spriteData.interval = 100;
            
            m.setSprite("die");
			m.die();				
		}

	}
}